package com.jz.main.io.queue;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;
import java.util.PriorityQueue;

public class LinkedListTest {
    public static void main(String[] args) {

        ArrayDeque<String> linkedList = new ArrayDeque<>();
        LinkedList<String> linkedList2 = new LinkedList<>();
        PriorityQueue<String> priorityQueue = new PriorityQueue<>();
        linkedList.add("12");
        linkedList.add("34");
        linkedList.add("56");
        linkedList.add("78");
        linkedList.add("99");

        linkedList2.add("12");
        linkedList2.add("34");
        linkedList2.add("56");
        linkedList2.add("78");
        linkedList2.add("99");

        priorityQueue.add("12");
        priorityQueue.add("78");
        priorityQueue.add("34");
        priorityQueue.add("56");
        priorityQueue.add("99");
        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.poll());
//        priorityQueue.comparator()
//        priorityQueue.comparator()

//        test(linkedList);
        System.out.println(linkedList2.pop());
        System.out.println(linkedList2.pop());
        linkedList2.push("12333");
        System.out.println(linkedList2.pop());
        System.out.println(linkedList2.pop());
    }

    static void test(Deque<String> linkedList){
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.peek());
        System.out.println(linkedList.peekLast());
        System.out.println(linkedList.peekFirst());
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.getLast());
        System.out.println(linkedList.getLast());
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.poll());
        System.out.println(linkedList.poll());
        System.out.println(linkedList.pollLast());
        System.out.println(linkedList.pollLast());
        System.out.println(linkedList.pollFirst());
        System.out.println("===================");

    }

}
